#include "Resources.h"

Resources* Resources::_ResourcesGame = NULL;

Resources* Resources::CreateResources(LPDIRECT3DDEVICE9 pd3d, LPDIRECT3DSURFACE9 buffer, HWND hWnd)
{
	if (_ResourcesGame == NULL)
	{
		_ResourcesGame = new Resources(pd3d, buffer, hWnd);
	}

	return _ResourcesGame;
}

Resources::~Resources()
{
	// Images
	delete Items;
	delete MarioBig;
	delete MarioSmall;
	delete MarioFire;
	delete Goomba;
	delete Koopa;
	delete KoopaA;
	delete Brick;
	delete Coin;
	delete Bullet;
	delete Cloud;
	delete Mountain;
	delete Pipe1;
	delete Pipe2;
	delete Pipe3;
	delete Eat;
	delete Score;
	delete Info;
	delete QBrick;
	delete Imenu;
	delete Ladder;
	delete Select;
	delete Number;
	delete Boss;
	delete FireBoss;
	delete Check;
	delete CCC;

	delete _bgMenu;
	delete _bgGame;
	delete _bgGame2;
	delete _bgGame3;
	delete _bgHelp;
	delete _bgHelp2;
	delete _bgOption;

	// Sound
	delete _audio;

	delete  Background;
	delete  BonusRise;
	delete  BrickBreaked;
	delete  Bump;
	delete  CoinS;
	delete  Death;
	delete  FireBall;
	delete  GameOver;
	delete  Jump;
	delete  Kick;
	delete  Life;
	delete  Mip;
	delete  PipeWarp;
	delete  PowerUp;
	delete  Selected;
	delete  StartGame;
	delete  WinState;
}

Resources::Resources(LPDIRECT3DDEVICE9 pd3d, LPDIRECT3DSURFACE9 buffer, HWND hWnd)
{
	_pd3ddv = pd3d;
	_back_buffer = buffer;

	Items = new Texture(pd3d);
	Items->LoadTexture("Resources\\Images\\listitem.png", NULL);

	MarioBig = new Texture(pd3d);
	MarioBig->LoadTexture("Resources\\Images\\mariobig.png", NULL);
	
	MarioSmall = new Texture(pd3d);
	MarioSmall->LoadTexture("Resources\\Images\\mariosmall.png", NULL);
	
	MarioFire = new Texture(pd3d);
	MarioFire->LoadTexture("Resources\\Images\\mariofire.png", NULL);
	
	Goomba = new Texture(pd3d);
	Goomba->LoadTexture("Resources\\Images\\goomba.png", NULL);
	
	Koopa = new Texture(pd3d);
	Koopa->LoadTexture("Resources\\Images\\koopa.png", NULL);

	KoopaA = new Texture(pd3d);
	KoopaA->LoadTexture("Resources\\Images\\koopaA.png", NULL);
	
	Brick = new Texture(pd3d);
	Brick->LoadTexture("Resources\\Images\\brick.png", NULL);
	
	Coin = new Texture(pd3d);
	Coin->LoadTexture("Resources\\Images\\coin.png", NULL);
	
	Bullet = new Texture(pd3d);
	Bullet->LoadTexture("Resources\\Images\\bullet.png", NULL);
	
	Cloud = new Texture(pd3d);
	Cloud->LoadTexture("Resources\\Images\\cloud.png", NULL);
	
	Mountain = new Texture(pd3d);
	Mountain->LoadTexture("Resources\\Images\\scenes.png", NULL);
	
	Pipe1 = new Texture(pd3d);
	Pipe1->LoadTexture("Resources\\Images\\pipe1.png", NULL);
	
	Pipe2 = new Texture(pd3d);
	Pipe2->LoadTexture("Resources\\Images\\pipe2.png", NULL);
	
	Pipe3 = new Texture(pd3d);
	Pipe3->LoadTexture("Resources\\Images\\pipe3.png", NULL);

	Eat = new Texture(pd3d);
	Eat->LoadTexture("Resources\\Images\\eatflower.png", NULL);
	
	Score = new Texture(pd3d);
	Score->LoadTexture("Resources\\Images\\number.png", NULL);
	
	Info = new Texture(pd3d);
	Info->LoadTexture("Resources\\Images\\info.png", NULL);
	
	QBrick = new Texture(pd3d);
	QBrick->LoadTexture("Resources\\Images\\qbrick.png", NULL);
	
	Ladder = new Texture(pd3d);
	Ladder->LoadTexture("Resources\\Images\\ladder.png", NULL);

	Select = new Texture(pd3d);
	Select->LoadTexture("Resources\\Images\\select.png", NULL);

	Number = new Texture(pd3d);
	Number->LoadTexture("Resources\\Images\\number.png", NULL);

	Boss = new Texture(pd3d);
	Boss->LoadTexture("Resources\\Images\\boss.png", NULL);

	FireBoss = new Texture(pd3d);
	FireBoss->LoadTexture("Resources\\Images\\fire.png", NULL);

	Check = new Texture(pd3d);
	Check->LoadTexture("Resources\\Images\\check.png", NULL);

	CCC = new Texture(pd3d);
	CCC->LoadTexture("Resources\\Images\\ccc.png", NULL);

	_bgMenu = new Surface(pd3d);
	_bgMenu->LoadSurface("Resources\\Images\\bgmenu.jpg", NULL);

	_bgGame = new Surface(pd3d);
	_bgGame->LoadSurface("Resources\\Images\\backgroundplay1.png", NULL);

	_bgGame2 = new Surface(pd3d);
	_bgGame2->LoadSurface("Resources\\Images\\backgroundplay2.jpg", NULL);

	_bgGame3 = new Surface(pd3d);
	_bgGame3->LoadSurface("Resources\\Images\\backgroundplay3.jpg", NULL);

	_bgHelp = new Surface(pd3d);
	_bgHelp->LoadSurface("Resources\\Images\\backgroundhelp1.png", NULL);

	_bgHelp2 = new Surface(pd3d);
	_bgHelp2->LoadSurface("Resources\\Images\\backgroundhelp2.png", NULL);

	_bgOption = new Surface(pd3d);
	_bgOption->LoadSurface("Resources\\Images\\backgroundoption.jpg", NULL);


	_audio = new Audio(hWnd);
	Background = _audio->LoadSound("Resources\\Sounds\\Background.wav");
	BonusRise = _audio->LoadSound("Resources\\Sounds\\BonusRise.wav");
	BrickBreaked = _audio->LoadSound("Resources\\Sounds\\BrickBreaked.wav");
	Bump = _audio->LoadSound("Resources\\Sounds\\bump.wav");
	CoinS = _audio->LoadSound("Resources\\Sounds\\Coin.wav");
	Death = _audio->LoadSound("Resources\\Sounds\\Death.wav");
	FireBall = _audio->LoadSound("Resources\\Sounds\\fireball.wav");
	GameOver = _audio->LoadSound("Resources\\Sounds\\GameOver.wav");
	Jump = _audio->LoadSound("Resources\\Sounds\\Jump.wav");
	Kick = _audio->LoadSound("Resources\\Sounds\\kick.wav");
	Life = _audio->LoadSound("Resources\\Sounds\\Life.wav");
	Mip = _audio->LoadSound("Resources\\Sounds\\mip.wav");
	PipeWarp = _audio->LoadSound("Resources\\Sounds\\PipeWarp.wav");
	PowerUp = _audio->LoadSound("Resources\\Sounds\\PowerUp.wav");
	Selected = _audio->LoadSound("Resources\\Sounds\\sel.wav");
	StartGame = _audio->LoadSound("Resources\\Sounds\\StartGame.wav");
	WinState = _audio->LoadSound("Resources\\Sounds\\WinStage.wav");
}